<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="org.apache.catalina.Session"%>
<%@ page import="java.sql.Date,java.sql.*"%>
<%@ page import="cn.ticket.db.DBConnect"%>
<%@ page import="cn.ticket.util.StringUtil"%>
<%@ page import="cn.ticket.Constant"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>车票列表</title>
</head>
<body>
	<jsp:include page="/front/common/head.jsp"></jsp:include>
	<div class="content">
		<jsp:include page="/front/common/bar_left.jsp"></jsp:include>
		<div class="row">
		<label class="lable" style="margin-left:20px;">加盟列表</label>　 　
		<span><%=request.getParameter("result")==null?"":"success".equals(request.getParameter("result"))?"操作成功!":"网络异常,请稍后再操作." %></span>
			<table class="table table-hover">
				<tr>
					<td>序号</td>
					<td>车次</td>
					<td>始发站</td>
					<td>终点站</td>
					<td>开车时间</td>
					<td>价格</td>
					<td rolspan=2>操作</td>
				</tr>
				<%
					request.setCharacterEncoding("utf8");
					String id = StringUtil.createUUID();
					String userId = (String) session.getAttribute("login_user_id");
					Connection con = new DBConnect().DBConnection();
					try {
						String sql = "select id,num,oriStation,desStation,time,price from ticket where status<>4 "
								+ (userId == null ? "" : " and user_id='" + userId+ "'");
						PreparedStatement pstmt = con.prepareStatement(sql);
						ResultSet rs = pstmt.executeQuery();
						while (rs.next()) {
				%>
				<tr>
					<td><%=rs.getRow()%></td>
					<td><%=rs.getString(2)%></td>
					<td><%=rs.getString(3)%></td>
					<td><%=rs.getString(4)%></td>
					<td><%=rs.getString(5)%></td>
					<td><%=rs.getInt(6)%></td>
					<td>
						<a class="btn btn-primary"	href="<%=basePath%>front/ticket/ticketUpdate.jsp?id=<%=rs.getString(1)%>">改签</a>
						<a class="btn btn-danger" href="<%=basePath%>front/ticket/ticketDel_handle.jsp?id=<%=rs.getString(1)%>">退订</a>
					</td>
				</tr>
				<%
					}
					} catch (Exception e) {
						e.printStackTrace();
					}
				%>
				</tr>
			</table>
		</div>
	</div>
	<jsp:include page="/front/common/footer.jsp"></jsp:include>
</body>
</html>